package com.ts.code.creator.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 返回类型： 空类、id类、集合、分页、自定义
 */
@Getter
@AllArgsConstructor
public enum RetTypeEnum {
    NULL("空类"),
    ID("id类"),
    LIST("集合"),
    PAGE("分页"),
    COMMON("普通类");

    private String name;

    public static RetTypeEnum getByName(String name) {
        return Arrays.stream(RetTypeEnum.values()).filter(t -> t.getName().equals(name)).findAny().orElse(null);
    }

    /**
     * 是否创建返回类
     * @param retTypeEnum 枚举
     * @return 是否
     */
    public static boolean isCreateRetClass(RetTypeEnum retTypeEnum) {
        return retTypeEnum == LIST || retTypeEnum == PAGE || retTypeEnum == COMMON;
    }

}
